package net.ojbk.study.curriculumDesign.service.impl.canvasmodel;

import net.ojbk.study.curriculumDesign.beans.canvasmodel.Canvas;
import net.ojbk.study.curriculumDesign.dao.canvasmodel.CanvasDao;
import net.ojbk.study.curriculumDesign.service.canvasmodel.ICanvasService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

@Service("canvasService")
public class CanvasServiceImpl implements ICanvasService {
    @Autowired
    @Qualifier("canvasDao")
    private CanvasDao canvasDao;

    /* 方法用途对应接口中注释*/
    @Override
    public List<Canvas> getCanvas(int skip, int size) {
        return canvasDao.selectByPage(skip, size);
    }

    @Override
    public List<Canvas> getCanvasBycgid(Integer cgid, int skip, int size) {
        return canvasDao.selectBycgid(cgid, skip, size);
    }

    @Override
    public int countCakesBycgid(int cgid) {
        return canvasDao.countBycgid(cgid);
    }

    @Override
    public void addCanvas(Canvas canvas) {
        canvasDao.insertOne(canvas);
    }

    @Override
    public void updateCanvas(Canvas canvas) {
        canvasDao.updateOne(canvas);

    }

    @Override
    public String getImg(int cid) {
        return canvasDao.selectimg(cid);
    }

    @Override
    public Canvas getOneByid(Integer cid) {
        return canvasDao.selectOneCanvas(cid);
    }

    @Override
    public Set<Canvas> selectAllInsallCanvas(String uid) {
        return canvasDao.getAllCanvasByUid(uid);
    }

    @Override
    public void deleteOneByid(Integer cid) {
         canvasDao.deleteBycid(cid);
    }

}
